home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / TUTORIAL.BIN / NervousText.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-01-30  |  2.8 KB  |  66 lines

  1. package symantec.itools.db.awt;
  2.  
  3. import java.io.IOException;
  4. import symantec.itools.db.pro.ProjBinder;
  5. import symantec.itools.db.pro.ProjLink;
  6. import symantec.itools.db.pro.RelationView;
  7. import symjava.sql.SQLException;
  8.  
  9. public class NervousText extends symantec.itools.multimedia.NervousText implements ProjLink {
  10.    private int m_treatBlankAs;
  11.    private boolean m_DynamicUpdate = false;
  12.    private ProjBinder m_ProjBinder;
  13.  
  14.    public void setBinding(RelationView relView, String projection) {
  15.       try {
  16.          int projectionNumber = relView.findProjByName(projection);
  17.          relView.bindProj(projectionNumber, this);
  18.       } catch (SQLException Ex) {
  19.          this.raiseException("SQLException from NervousText.setBinding: " + ((Throwable)Ex).getMessage());
  20.       }
  21.    }
  22.  
  23.    public void init(ProjBinder binder) {
  24.       this.m_ProjBinder = binder;
  25.    }
  26.  
  27.    public void notifyDataChange(ProjBinder binder) {
  28.       try {
  29.          if (binder.getStringValue() != null) {
  30.             super.setText(binder.getStringValue());
  31.          } else {
  32.             super.setText("");
  33.          }
  34.       } catch (SQLException Ex) {
  35.          this.raiseException("SQLException from NervousText.notifyDataChange: " + ((Throwable)Ex).getMessage());
  36.       } catch (IOException Ex) {
  37.          this.raiseException("IOException from NervousText.notifyDataChange: " + ((Throwable)Ex).getMessage());
  38.       }
  39.    }
  40.  
  41.    public boolean notifySetData(ProjBinder binder) throws SQLException {
  42.       return true;
  43.    }
  44.  
  45.    public void setTreatBlankAs(String blank) {
  46.       if ((new String(blank)).toUpperCase().equals("DEFAULT")) {
  47.          this.m_treatBlankAs = 0;
  48.       } else if ((new String(blank)).toUpperCase().equals("NULL")) {
  49.          this.m_treatBlankAs = 1;
  50.       } else {
  51.          if ((new String(blank)).toUpperCase().equals("EMPTY")) {
  52.             this.m_treatBlankAs = 2;
  53.          }
  54.  
  55.       }
  56.    }
  57.  
  58.    void raiseException(String text) {
  59.       System.out.println(text);
  60.    }
  61.  
  62.    public void setDynamicUpdate(boolean update) {
  63.       this.m_DynamicUpdate = update;
  64.    }
  65. }
  66.